package com.itcast.eureka.client.controller;

import com.itcast.eureka.client.dao.CmsPageRepository;
import com.itcast.eureka.client.model.CmsPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Optional;

@RestController
@RequestMapping("/cmspage")
public class CmsPageController {

    @Autowired
    private CmsPageRepository cmsPageRepository;

    @RequestMapping("/findone/{id}")
    public CmsPage findOne(@PathVariable("id") String id){

        Optional<CmsPage> cmsPage = (Optional<CmsPage>) cmsPageRepository.findById(id);
        return cmsPage.get();

    }
}
